package com.tg.sieve_data.po;

import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;

import java.util.Objects;

@Data
public class TgGroupExportPO {
    /**
     * 群链接
     */
    @ExcelProperty("群链接")
    private String groupLink;
    /**
     * 群名称
     */
    @ExcelProperty("群名称")
    private String title;
    /**
     * 群人数
     */
    @ExcelProperty("群人数")
    private Integer memberCount;
    /**
     * 群语言
     */
    @ExcelProperty("群语言")
    private String language;
    /**
     * 是否公开群
     */
    @ExcelProperty("是否公开群")
    private String isPublic;
    /**
     * 是否广告群
     */
    @ExcelProperty("是否广告群")
    private String isAd;
    /**
     * 是否垃圾群
     */
    @ExcelProperty("是否垃圾群")
    private String isTrash;
    /**
     * 是否币圈群
     */
    @ExcelProperty("是否币圈群")
    private String isCrypto;
     /**
     * 区域标签
     */
    @ExcelProperty("区域标签")
    private String region;

    // 将数字类型的状态字段转换为中文描述
    public static TgGroupExportPO fromTgGroupPO(TgGroupPO po) {
        TgGroupExportPO exportPO = new TgGroupExportPO();
        exportPO.setGroupLink(po.getGroupLink());
        exportPO.setMemberCount(po.getMemberCount());
        exportPO.setLanguage(po.getLanguage());
        exportPO.setIsCrypto( Objects.isNull(po.getIsCrypto())?"否":po.getIsCrypto() == 1 ? "是" : "否");
        exportPO.setIsPublic( Objects.isNull(po.getIsPublic())?"否":po.getIsPublic() == 1 ? "是" : "否");
        exportPO.setIsAd( Objects.isNull(po.getIsAd())?"否":po.getIsAd() == 1 ? "是" : "否");
        exportPO.setIsTrash( Objects.isNull(po.getIsTrash())?"否":po.getIsTrash() == 1 ? "是" : "否");
        exportPO.setRegion(po.getRegion());
        exportPO.setTitle(po.getTitle());
        return exportPO;
    }
}
